package com.hhh.demo.sx.config;

import com.hhh.demo.sx.Interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author lenovo
 * @create 2022/1/1 15:28
 */
@Configuration
public class WebConfig  implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**","/*.html") //拦截  "/**"所有请求都被拦截 静态资源也被拦截
                .excludePathPatterns("/login","/css/**","/js/**","/plugins/**"); //放行'
    }
}
